From 90ab706fe8b19cf49b28fe570510098f4e2f9000 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jes=C3=BAs=20Espino?= Date: Fri, 4 Mar 2016 08:45:26 +0100 Subject: [PATCH] Return Err if target don't support dylib (fix #2427) --- src/cargo/ops/cargo_rustc/context.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 8d88ac384..f689998ad 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -317,8 +317,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> { for lib in libs.iter() { match *lib { LibKind::Dylib => { - if let Ok((prefix, suffix)) = self.dylib(unit.kind) { - ret.push(format!("{}{}{}", prefix, stem, suffix)); + match self.dylib(unit.kind) { + Ok((prefix, suffix)) => + ret.push(format!("{}{}{}", prefix, stem, suffix)), + Err(e) => try!(self.config.shell().warn(format!("{}", e))) } } LibKind::Lib | @@ -332,7 +334,9 @@ impl<'a, 'cfg> Context<'a, 'cfg> { } } } - assert!(!ret.is_empty()); + if ret.is_empty() { + bail!("no valid targets found") + } Ok(ret) } -- 2.30.2